package com.arron.algorithm.leetcodetop100;


/**
 *
 * Leetcode 20. 有效的括号
 *
 */
public class ValidParentheses {


    public static void main(String[] args) {
        String s = "()[]{}";
//        s = "(]";
//        s = "([)]";
        s = "{[]}";
        s = s.replace("()", "").replace("{}", "").replace("[]", "");
        System.out.println(s.length());
    }

    public boolean isValid(String s) {


        int len= s.length()/2;
        for (int i = 0; i < len; i++) {
            s = s.replace("()", "").replace("{}", "").replace("[]", "");
        }


        return s.length()==0;
    }


}
